package com.frank.entity;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @Author: huweifeng
 * @Date: 2022/11/27
 * @Description: Bean的生命周期
 **/
@Component
public class BeanLife3 {
    public BeanLife3() {
        System.out.println("BeanLife3 constructor...");
    }
    // 对象创建并赋值之后调用
    @PostConstruct
    public void postConstruct() {
        System.out.println("BeanLife3 @PostConstruct...");
    }
    // 容器移除对象之前
    @PreDestroy
    public void preDestroy() {
        System.out.println("BeanLife3 @PreDestroy...");
    }
}
